package com.lulufind.lulu.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.lulufind.lulu.model.Result;
import com.lulufind.lulu.model.Shuoshuo;
import com.lulufind.lulu.service.ShuoshuoService;

@Controller
@RequestMapping("/shuoshuo")
public class ShuoshuoController {
	
	@Autowired
	ShuoshuoService shuoshuoService;

	
	@ResponseBody
	@RequestMapping(value="/addShuoshuo",produces="application/json;charset=UTF-8")
	public String addShuoshuo(Shuoshuo shuoshuo, String userToken, Integer transmit, Integer coterieId, String coterieImage){
		
		Result<String> rs = shuoshuoService.addShuoshuo(shuoshuo, userToken, transmit, coterieId, coterieImage);
		
		Gson gson = new Gson();
		String s = gson.toJson(rs);
		return s;
	}
	
	@ResponseBody
	@RequestMapping(value="/delShuoshuo",produces="application/json;charset=UTF-8")
	public String delShuoshuo(Integer shuoshuoId, Integer userId, String userToken){
		
		Result<String> rs = shuoshuoService.delShuoshuo(shuoshuoId, userId, userToken);
		
		Gson gson = new Gson();
		String s = gson.toJson(rs);
		return s;
	}
	
}
